var client = null;
var headers = new Object();
headers.id='1234';

function openStompConnect(){
	var ws = new WebSocket('ws://127.0.0.1:15674/ws');
	client = null;
	client = Stomp.over(ws);
	
	var on_connect = function() {
		headers.durable=true;
		headers['auto-delete']=false;
	    client.subscribe("/exchange/exchange_pushmsg/rk_pushmsg_666666", function(m) {
			var reversedText = m.body.split("").reverse().join("");
	        console.log(reversedText);
	    },headers);
	};
	
	var on_error =  function() {
	    console.log('error');
	};
	
	client.connect('zhdd','ZHdd@xa2018',on_connect,on_error,'/');
	console.log('open connection');
}

function closeStompConnect(){
	headers.durable=false;
	headers['auto-delete']=true;
	if(client){
		client.disconnect(function(){
			console.log('close connection');
		},headers);
	}
}

